//! MySQL 简单测试示例

#[cfg(feature = "database")]
use dataforge::filling::{MySqlFillerSync, FillingConfig, ConnectionConfig};

#[cfg(feature = "database")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
    println!("MySQL 数据填充简单测试");
    
    // 创建连接配置
    let connection_config = ConnectionConfig::mysql("localhost", "demo", "root", "Aa123456")
        .with_port(13307);
    
    // 创建填充配置
    let filling_config = FillingConfig {
        batch_size: 100,
        use_transaction: true,
        timeout_seconds: 30,
        retry_count: 3,
    };
    
    // 创建MySQL填充器
    let filler = MySqlFillerSync::from_config(connection_config, filling_config)?;
    
    println!("连接字符串: {}", filler.connection_string);
    println!("批次大小: {}", filler.config.batch_size);
    
    // 检查employees表是否存在
    match filler.table_exists("employees") {
        Ok(exists) => {
            if exists {
                println!("✓ employees表存在");
            } else {
                println!("✗ employees表不存在");
            }
        },
        Err(e) => {
            println!("检查表存在性时出错: {}", e);
        }
    }
    
    println!("MySQL配置验证完成");
    Ok(())
}

#[cfg(not(feature = "database"))]
fn main() {
    println!("需要启用database特性才能运行此示例");
    println!("请使用: cargo run --example mysql_simple_test --features database");
}